/// <reference types="vitest" />

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import vueI18n from '@intlify/unplugin-vue-i18n/vite'
import components from 'unplugin-vue-components/vite'
import unocss from 'unocss/vite'
import { ArcoResolver } from 'unplugin-vue-components/resolvers'
import { fileURLToPath } from 'node:url'
import lightningcss from 'vite-plugin-lightningcss'

export default defineConfig({
  plugins: [
    vue(),
    vueJsx(),
    unocss(),
    lightningcss({ browserslist: '>= 0.25%', include: 1 }),
    vueI18n({ jitCompilation: true }),
    components({
      dts: './src/types/components.d.ts',
      resolvers: [ArcoResolver({ sideEffect: true })]
    })
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  test: { environment: 'happy-dom' },
  css: { transformer: 'postcss' },
  build: {
    cssMinify: 'lightningcss',
    chunkSizeWarningLimit: 600
  }
})
